#!/bin/bash
{{ mysql_bin_dir }}/mysql -uroot -S /tmp/mysql3306.sock -p123.com -e "create database if not exists {{ zabbix_db }} character set utf8 collate utf8_bin;"
{{ mysql_bin_dir }}/mysql -uroot -S /tmp/mysql3306.sock -p123.com -e "create user {{ zabbix_db_user }}@'{{ zabbix_serverip }}' identified by '{{ zabbix_db_password }}';"
{{ mysql_bin_dir }}/mysql -uroot -S /tmp/mysql3306.sock -p123.com -e "grant all privileges on {{ zabbix_db }}.* to {{ zabbix_db_user }}@{{ zabbix_serverip }};"
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz |{{ mysql_bin_dir }}/mysql -u{{ zabbix_db_user }} -p{{ zabbix_db_password }} -h{{ zabbix_serverip }} --default-character-set=utf8 {{ zabbix_db_user }}
